#define _CRT_SECURE_NO_WARNINGS  1

#include<stdio.h>

int main()
{
	int count = 0;
	int n = 0;
	int m = 0;
	scanf("%d", &n);
	int arr[10000] = {0};
	for (m = 0; m < n * n; m++)
	{
		scanf("%d", &arr[m]);
	}
	for (m = 0; m < n * n; m++)
	{
		if (m / n > 0 && m % n <= m / n && arr[m]==0)
		{
			count++;
		}
	}
	if (count == n * (n - 1) / 2)
	{
		printf("YES");
	}
	else
		printf("NO");
	return 0;
}